<!--  -->
<template>
<div class="">
   <a-drawer :visible="modalVisible" width="90%" @close="handleClose">
      <a-divider orientation="left">申请记录</a-divider>
        <f-search-form>
            <f-search-form-item label="专业包代码" name="majorCode" />
            <f-search-form-item label="专业包名称" name="majorName" slot="advanced" />
            <f-search-form-item label="工程包代码" name="packageNo" slot="advanced" />
            <f-search-form-item label="工程包名称" name="packageName" slot="advanced" />
            <f-search-form-item label="申请人" name="userName" slot="advanced" />
            <f-search-form-item label="申请时间" name="applyTime" type="date" slot="advanced" />
            <f-search-form-item label="申请状态" name="state" slot="advanced" />
        </f-search-form>
      <f-table style="margin-top: 30px" ref="table" size="default"  rowKey="purchaseId" :columns="columns" :multiple="false" :params="queryParam" :api="api.purchases" >
            <span slot="action" slot-scope="text, record">
<!--                <template>-->
<!--                    <a @click="roolback(record)">撤销</a>-->
<!--                    <a-divider type="vertical" />-->
<!--                </template>-->
                <template>
                    <a @click="$refs.pursedetail.handleShow(record)">查看详情</a>
<!--                    <a-divider type="vertical" />-->
                </template>
                <template>
                    <a @click="$refs.recordFile.handleShow(record)">查看附件</a>
                    <a-divider type="vertical" />
                </template>
            </span>
        </f-table>
<!--        <app-detail ref="detail"></app-detail>-->
<!--      <pursedetail ref="purseDetail"></pursedetail>-->
      <purse-detail ref="pursedetail"></purse-detail>
     <ApplicationRecordFile ref="recordFile"></ApplicationRecordFile>
    </a-drawer>
</div>
</template>
0
<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
// import AppDetail from './applicationdetail'
import api from '../../material/app/js/api'
import purseDetail from  './pursedetail'
import ApplicationRecordFile from './applicationrecordfile'
export default {
    name: 'Apprecode',
    components: {
      purseDetail,
      ApplicationRecordFile
    },
    props: {},
    //import引入的组件需要注入到对象中才能使用
    data() {
        //这里存放数据
        const me = this
        return {
          api: Object.assign(api, this.api),
          //列表初始化查询参数
           queryParam: {},
            projectId: '',
            userId: '',
            modalVisible: false,
            columns: [{
                    title: '项目代码',
                    align: 'center',
                    dataIndex: 'projectCode'
                },
                {
                    title: '项目名称',
                    align: 'center',
                    dataIndex: 'projectName'
                },
                {
                    title: '工程包代码',
                    align: 'center',
                    dataIndex: 'packageNo'
                },
                {
                    title: '工程包名称',
                    align: 'center',
                    dataIndex: 'packageName'
                },
                {
                    title: '专业代码',
                    align: 'center',
                    dataIndex: 'majorCode'
                },
                {
                    title: '专业名称',
                    align: 'center',
                    dataIndex: 'majorName'
                },
                {
                    title: '申请人',
                    align: 'center',
                    dataIndex: 'userName'
                },
                {
                    title: '申请时间',
                    align: 'center',
                    dataIndex: 'createTime'
                },
                {
                    title: '申请状态',
                    align: 'center',
                    dataIndex: 'applayStatus',
                     customRender: function (text) {
                     return me.columnFormatter(api.purchases.applayStatus, text)
                  }
                },
                {
                    title: '操作',
                    align: 'center',
                    dataIndex: 'action',
                    width: 100,
                    scopedSlots: {
                        customRender: 'action'
                    }
                }
            ]
        }
    },
    //监听属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods: {
        handleShow(data) {
            this.isEdit = false
            this.userName = ''
            this.queryParam.projectId = data.projectId
             this.queryParam.userId = data.userId
            if (data && data.userId) {
                this.isEdit = true
                this.userName = data.userName
                this.formData = data
            } else {
                this.formData = {}
            }
            this.modalVisible = true
            this.$refs.table.refresh()
        },
        handleClose() {
            this.modalVisible = false
        },
        //撤销
       roolback(data) {
       }
    },
    created() {
    },

}
</script>

<style lang="scss" scoped>
//@import url(); 引入公共css类
</style>
